using System;
using System.Collections.Generic;
using Azure.Domain.Models;
using Azure.Domain.Services;
using Azure.Infrastructure;
using Azure.Web.Configuration;
using Azure.Web.Controllers;
using Rhino.Mocks;
using Xunit;

namespace Azure.Tests.Web.Controllers
{
    public class FeedControllerFacts : ControllerFacts<FeedController>
    {
        public FeedControllerFacts() : base(Routing.Configure)
        {
        }

        [Fact]
        public void AtomReturnsTheLatestPosts()
        {
            Request.Stub(x => x.Url).Return(new Uri("http://wwww.weiker.org/Feed"));
            Mock<IBlogConfiguration>().Stub(p => p.Configuration).Return(new SiteConfiguration());
            Mock<IBlogService>().Expect(x => x.Last(20)).Return(new List<Post>() {Test.Post});

            var result = (FeedResult) ClassUnderTest.Atom();

            Assert.NotNull(result);
        }
    }
}